home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / mint / shells / tcsh6033.zoo / tcsh-603.pl3 / csh.1 < prev    next >
Text File  |  1993-03-15  |  81KB  |  1,453 lines

  1.  
  2. CSH(1)                       UNIX Reference Manual                      CSH(1)
  3.  
  4. N✓NA✓AM✓ME✓E
  5.      c✓cs✓sh✓h - a shell (command interpreter) with C-like syntax
  6.  
  7. S✓SY✓YN✓NO✓OP✓PS✓SI✓IS✓S
  8.      c✓cs✓sh✓h [-✓-b✓bc✓ce✓ef✓fi✓in✓ns✓st✓tv✓vV✓Vx✓xX✓X] [arg ...]
  9.  
  10. D✓DE✓ES✓SC✓CR✓RI✓IP✓PT✓TI✓IO✓ON✓N
  11.      The C✓Cs✓sh✓h is a command language interpreter incorporating a history mecha-
  12.      nism (see H✓Hi✓is✓st✓to✓or✓ry✓y S✓Su✓ub✓bs✓st✓ti✓it✓tu✓ut✓ti✓io✓on✓ns✓s), job control facilities (see J✓Jo✓ob✓bs✓s), in-
  13.      teractive file name and user name completion (see F✓Fi✓il✓le✓e N✓Na✓am✓me✓e C✓Co✓om✓mp✓pl✓le✓et✓ti✓io✓on✓n),
  14.      and a C-like syntax. It is used both as an interactive login shell and a
  15.      shell script command processor.
  16.  
  17.    A✓Ar✓rg✓gu✓um✓me✓en✓nt✓t l✓li✓is✓st✓t p✓pr✓ro✓oc✓ce✓es✓ss✓si✓in✓ng✓g
  18.      If the first argument (argument 0) to the shell is `-✓-' then this is a lo-
  19.      gin shell.  The flag arguments are interpreted as follows:
  20.  
  21.      -✓-b✓b     This flag forces a ``break'' from option processing, causing any
  22.             further shell arguments to be treated as non-option arguments.
  23.             The remaining arguments will not be interpreted as shell options.
  24.             This may be used to pass options to a shell script without confu-
  25.             sion or possible subterfuge.  The shell will not run a set-user ID
  26.             script without this option.
  27.  
  28.      -✓-c✓c     Commands are read from the (single) following argument which must
  29.             be present.  Any remaining arguments are placed in _✓a_✓r_✓g_✓v.
  30.  
  31.      -✓-e✓e     The shell exits if any invoked command terminates abnormally or
  32.             yields a non-zero exit status.
  33.  
  34.      -✓-f✓f     The shell will start faster, because it will neither search for
  35.             nor execute commands from the file _✓._✓c_✓s_✓h_✓r_✓c in the invoker's home
  36.             directory.
  37.  
  38.      -✓-i✓i     The shell is interactive and prompts for its top-level input, even
  39.             if it appears to not be a terminal.  Shells are interactive with-
  40.             out this option if their inputs and outputs are terminals.
  41.  
  42.      -✓-n✓n     Commands are parsed, but not executed.  This aids in syntactic
  43.             checking of shell scripts.
  44.  
  45.      -✓-s✓s     Command input is taken from the standard input.
  46.  
  47.      -✓-t✓t     A single line of input is read and executed.  A `\' may be used to
  48.             escape the newline at the end of this line and continue onto an-
  49.             other line.
  50.  
  51.      -✓-v✓v     Causes the _✓v_✓e_✓r_✓b_✓o_✓s_✓e variable to be set, with the effect that com-
  52.             mand input is echoed after history substitution.
  53.  
  54.      -✓-x✓x     Causes the _✓e_✓c_✓h_✓o variable to be set, so that commands are echoed
  55.             immediately before execution.
  56.  
  57.      -✓-V✓V     Causes the _✓v_✓e_✓r_✓b_✓o_✓s_✓e variable to be set even before _✓._✓c_✓s_✓h_✓r_✓c is exe-
  58.             cuted.
  59.  
  60.      -✓-X✓X     Is to -✓-x✓x as -✓-V✓V is to -✓-v✓v.
  61.  
  62.      After processing of flag arguments, if arguments remain but none of the
  63.      -✓-c✓c, -✓-i✓i, -✓-s✓s, or -✓-t✓t options were given, the first argument is taken as the
  64.      name of a file of commands to be executed.  The shell opens this file,
  65.      and saves its name for possible resubstitution by `$0'.  Since many sys-
  66.      tems use either the standard version 6 or version 7 shells whose shell
  67.      scripts are not compatible with this shell, the shell will execute such a
  68.      `standard' shell if the first character of a script is not a `#', i.e. if
  69.      the script does not start with a comment.  Remaining arguments initialize
  70.      the variable _✓a_✓r_✓g_✓v.
  71.  
  72.      An instance of c✓cs✓sh✓h begins by executing commands from the file
  73.      _✓/_✓e_✓t_✓c_✓/_✓c_✓s_✓h_✓._✓c_✓s_✓h_✓r_✓c and, if this is a login shell, _✓/_✓e_✓t_✓c_✓/_✓c_✓s_✓h_✓._✓l_✓o_✓g_✓i_✓n. It then ex-
  74.      ecutes commands from _✓._✓c_✓s_✓h_✓r_✓c in the _✓h_✓o_✓m_✓e directory of the invoker, and, if
  75.      this is a login shell, the file _✓._✓l_✓o_✓g_✓i_✓n in the same location.  It is typi-
  76.      cal for users on crt's to put the command ``stty crt'' in their _✓._✓l_✓o_✓g_✓i_✓n
  77.      file, and to also invoke tset(1) there.
  78.  
  79.      In the normal case, the shell will begin reading commands from the termi-
  80.      nal, prompting with `% '.  Processing of arguments and the use of the
  81.      shell to process files containing command scripts will be described lat-
  82.      er.
  83.  
  84.      The shell repeatedly performs the following actions: a line of command
  85.      input is read and broken into _✓w_✓o_✓r_✓d_✓s. This sequence of words is placed on
  86.      the command history list and parsed.  Finally each command in the current
  87.      line is executed.
  88.  
  89.      When a login shell terminates it executes commands from the files _✓._✓l_✓o_✓g_✓o_✓u_✓t
  90.      in the user's _✓h_✓o_✓m_✓e directory and _✓/_✓e_✓t_✓c_✓/_✓c_✓s_✓h_✓._✓l_✓o_✓g_✓o_✓u_✓t.
  91.  
  92.    L✓Le✓ex✓xi✓ic✓ca✓al✓l s✓st✓tr✓ru✓uc✓ct✓tu✓ur✓re✓e
  93.      The shell splits input lines into words at blanks and tabs with the fol-
  94.      lowing exceptions.  The characters `&' `|' `;' `<' `>' `(' `)' form sepa-
  95.      rate words.  If doubled in `&&', `||', `<<' or `>>' these pairs form sin-
  96.      gle words.  These parser metacharacters may be made part of other words,
  97.      or prevented their special meaning, by preceding them with `\'.  A new-
  98.      line preceded by a `\' is equivalent to a blank.
  99.  
  100.      Strings enclosed in matched pairs of quotations, `', ``' or `"', form
  101.      parts of a word; metacharacters in these strings, including blanks and
  102.      tabs, do not form separate words.  These quotations have semantics to be
  103.      described subsequently.  Within pairs of `'' or `"' characters a newline
  104.      preceded by a `\' gives a true newline character.
  105.  
  106.      When the shell's input is not a terminal, the character `#' introduces a
  107.      comment which continues to the end of the input line.  It is prevented
  108.      this special meaning when preceded by `\' and in quotations using ``',
  109.      `'', and `"'.
  110.  
  111.    C✓Co✓om✓mm✓ma✓an✓nd✓ds✓s
  112.      A simple command is a sequence of words, the first of which specifies the
  113.      command to be executed.  A simple command or a sequence of simple com-
  114.      mands separated by `|' characters forms a pipeline.  The output of each
  115.      command in a pipeline is connected to the input of the next.  Sequences
  116.      of pipelines may be separated by `;', and are then executed sequentially.
  117.      A sequence of pipelines may be executed without immediately waiting for
  118.      it to terminate by following it with an `&'.
  119.  
  120.      Any of the above may be placed in `(' `)' to form a simple command (which
  121.      may be a component of a pipeline, etc.)  It is also possible to separate
  122.      pipelines with `||' or `&&' indicating, as in the C language, that the
  123.      second is to be executed only if the first fails or succeeds respective-
  124.      ly. (See _✓E_✓x_✓p_✓r_✓e_✓s_✓s_✓i_✓o_✓n_✓s.)
  125.  
  126.    J✓Jo✓ob✓bs✓s
  127.      The shell associates a _✓j_✓o_✓b with each pipeline.  It keeps a table of cur-
  128.      rent jobs, printed by the _✓j_✓o_✓b_✓s command, and assigns them small integer
  129.      numbers.  When a job is started asynchronously with `&', the shell prints
  130.      a line which looks like:
  131.  
  132.            [1] 1234
  133.  
  134.      indicating that the job which was started asynchronously was job number 1
  135.      and had one (top-level) process, whose process id was 1234.
  136.  
  137.      If you are running a job and wish to do something else you may hit the
  138.      key ^✓^Z✓Z (control-Z) which sends a STOP signal to the current job.  The
  139.      shell will then normally indicate that the job has been `Stopped', and
  140.      print another prompt.  You can then manipulate the state of this job,
  141.      putting it in the _✓b_✓a_✓c_✓k_✓g_✓r_✓o_✓u_✓n_✓d with the _✓b_✓g command, or run some other com-
  142.      mands and then eventually bring the job back into the foreground with the
  143.      _✓f_✓o_✓r_✓e_✓g_✓r_✓o_✓u_✓n_✓d command _✓f_✓g. A ^✓^Z✓Z takes effect immediately and is like an in-
  144.      terrupt in that pending output and unread input are discarded when it is
  145.      typed.  There is another special key ^✓^Y✓Y which does not generate a STOP
  146.      signal until a program attempts to read(2) it.  This can usefully be
  147.      typed ahead when you have prepared some commands for a job which you wish
  148.      to stop after it has read them.
  149.  
  150.      A job being run in the background will stop if it tries to read from the
  151.      terminal.  Background jobs are normally allowed to produce output, but
  152.      this can be disabled by giving the command ``stty tostop''.  If you set
  153.      this tty option, then background jobs will stop when they try to produce
  154.      output like they do when they try to read input.
  155.  
  156.      There are several ways to refer to jobs in the shell.  The character `%'
  157.      introduces a job name.  If you wish to refer to job number 1, you can
  158.      name it as `%1'.  Just naming a job brings it to the foreground; thus
  159.      `%1' is a synonym for `fg %1', bringing job 1 back into the foreground.
  160.      Similarly saying `%1 &' resumes job 1 in the background.  Jobs can also
  161.      be named by prefixes of the string typed in to start them, if these pre-
  162.      fixes are unambiguous, thus `%ex' would normally restart a suspended
  163.      ex(1) job, if there were only one suspended job whose name began with the
  164.      string `ex'.  It is also possible to say `%?string' which specifies a job
  165.      whose text contains _✓s_✓t_✓r_✓i_✓n_✓g, if there is only one such job.
  166.  
  167.      The shell maintains a notion of the current and previous jobs.  In output
  168.      pertaining to jobs, the current job is marked with a `+' and the previous
  169.      job with a `-'.  The abbreviation `%+' refers to the current job and `%-'
  170.      refers to the previous job.  For close analogy with the syntax of the
  171.      _✓h_✓i_✓s_✓t_✓o_✓r_✓y mechanism (described below), `%%' is also a synonym for the cur-
  172.      rent job.
  173.  
  174.      The job control mechanism requires that the stty(1) option n✓ne✓ew✓w be set. It
  175.      is an artifact from a _✓n_✓e_✓w implementation of the tty driver which allows
  176.      generation of interrupt characters from the keyboard to tell jobs to
  177.      stop.  See stty(1) for details on setting options in the new tty driver.
  178.  
  179.    S✓St✓ta✓at✓tu✓us✓s r✓re✓ep✓po✓or✓rt✓ti✓in✓ng✓g
  180.      This shell learns immediately whenever a process changes state.  It nor-
  181.      mally informs you whenever a job becomes blocked so that no further
  182.      progress is possible, but only just before it prints a prompt.  This is
  183.      done so that it does not otherwise disturb your work.  If, however, you
  184.      set the shell variable _✓n_✓o_✓t_✓i_✓f_✓y, the shell will notify you immediately of
  185.      changes of status in background jobs.  There is also a shell command
  186.      _✓n_✓o_✓t_✓i_✓f_✓y which marks a single process so that its status changes will be
  187.      immediately reported.  By default _✓n_✓o_✓t_✓i_✓f_✓y marks the current process; sim-
  188.      ply say `notify' after starting a background job to mark it.
  189.  
  190.      When you try to leave the shell while jobs are stopped, you will be
  191.      warned that `You have stopped jobs.'  You may use the _✓j_✓o_✓b_✓s command to see
  192.      what they are.  If you do this or immediately try to exit again, the
  193.      shell will not warn you a second time, and the suspended jobs will be
  194.      terminated.
  195.  
  196.    F✓Fi✓il✓le✓e N✓Na✓am✓me✓e C✓Co✓om✓mp✓pl✓le✓et✓ti✓io✓on✓n
  197.      When the file name completion feature is enabled by setting the shell
  198.      variable _✓f_✓i_✓l_✓e_✓c (see s✓se✓et✓t), c✓cs✓sh✓h will interactively complete file names and
  199.      user names from unique prefixes, when they are input from the terminal
  200.      followed by the escape character (the escape key, or control-[) For exam-
  201.      ple, if the current directory looks like
  202.  
  203.            DSC.OLD  bin      cmd      lib      xmpl.c
  204.            DSC.NEW  chaosnet cmtest   mail     xmpl.o
  205.            bench    class    dev      mbox     xmpl.out
  206.  
  207.      and the input is
  208.  
  209.            % vi ch<escape>
  210.  
  211.      c✓cs✓sh✓h will complete the prefix ``ch'' to the only matching file name
  212.      ``chaosnet'', changing the input line to
  213.  
  214.            % vi chaosnet
  215.  
  216.      However, given
  217.  
  218.            % vi D<escape>
  219.  
  220.      c✓cs✓sh✓h will only expand the input to
  221.  
  222.            % vi DSC.
  223.  
  224.      and will sound the terminal bell to indicate that the expansion is incom-
  225.      plete, since there are two file names matching the prefix ``D''.
  226.  
  227.      If a partial file name is followed by the end-of-file character (usually
  228.      control-D), then, instead of completing the name, c✓cs✓sh✓h will list all file
  229.      names matching the prefix.  For example, the input
  230.  
  231.            % vi D<control-D>
  232.  
  233.      causes all files beginning with ``D'' to be listed:
  234.  
  235.            DSC.NEW   DSC.OLD
  236.  
  237.      while the input line remains unchanged.
  238.  
  239.      The same system of escape and end-of-file can also be used to expand par-
  240.      tial user names, if the word to be completed (or listed) begins with the
  241.      character ``~''.  For example, typing
  242.  
  243.            cd ~ro<escape>
  244.  
  245.      may produce the expansion
  246.  
  247.            cd ~root
  248.  
  249.      The use of the terminal bell to signal errors or multiple matches can be
  250.      inhibited by setting the variable _✓n_✓o_✓b_✓e_✓e_✓p.
  251.  
  252.      Normally, all files in the particular directory are candidates for name
  253.      completion.  Files with certain suffixes can be excluded from considera-
  254.      tion by setting the variable _✓f_✓i_✓g_✓n_✓o_✓r_✓e to the list of suffixes to be ig-
  255.      nored.  Thus, if _✓f_✓i_✓g_✓n_✓o_✓r_✓e is set by the command
  256.  
  257.            % set fignore = (.o .out)
  258.  
  259.      then typing
  260.  
  261.            % vi x<escape>
  262.  
  263.  
  264.      would result in the completion to
  265.  
  266.            % vi xmpl.c
  267.  
  268.      ignoring the files "xmpl.o" and "xmpl.out".  However, if the only comple-
  269.      tion possible requires not ignoring these suffixes, then they are not ig-
  270.      nored.  In addition, _✓f_✓i_✓g_✓n_✓o_✓r_✓e does not affect the listing of file names by
  271.      control-D.  All files are listed regardless of their suffixes.
  272.  
  273.    S✓Su✓ub✓bs✓st✓ti✓it✓tu✓ut✓ti✓io✓on✓ns✓s
  274.      We now describe the various transformations the shell performs on the in-
  275.      put in the order in which they occur.
  276.  
  277.    H✓Hi✓is✓st✓to✓or✓ry✓y s✓su✓ub✓bs✓st✓ti✓it✓tu✓ut✓ti✓io✓on✓ns✓s
  278.      History substitutions place words from previous command input as portions
  279.      of new commands, making it easy to repeat commands, repeat arguments of a
  280.      previous command in the current command, or fix spelling mistakes in the
  281.      previous command with little typing and a high degree of confidence.
  282.      History substitutions begin with the character `!' and may begin _✓a_✓n_✓y_✓w_✓h_✓e_✓r_✓e
  283.      in the input stream (with the proviso that they d✓do✓o n✓no✓ot✓t nest.)  This `!'
  284.      may be preceded by an `\' to prevent its special meaning; for conve-
  285.      nience, a `!' is passed unchanged when it is followed by a blank, tab,
  286.      newline, `=' or `('.  (History substitutions also occur when an input
  287.      line begins with `^'.  This special abbreviation will be described lat-
  288.      er.)  Any input line which contains history substitution is echoed on the
  289.      terminal before it is executed as it could have been typed without histo-
  290.      ry substitution.
  291.  
  292.      Commands input from the terminal which consist of one or more words are
  293.      saved on the history list.  The history substitutions reintroduce se-
  294.      quences of words from these saved commands into the input stream.  The
  295.      size of which is controlled by the _✓h_✓i_✓s_✓t_✓o_✓r_✓y variable; the previous command
  296.      is always retained, regardless of its value.  Commands are numbered se-
  297.      quentially from 1.
  298.  
  299.      For definiteness, consider the following output from the _✓h_✓i_✓s_✓t_✓o_✓r_✓y command:
  300.  
  301.             9  write michael
  302.            10  ex write.c
  303.            11  cat oldwrite.c
  304.            12  diff *write.c
  305.  
  306.      The commands are shown with their event numbers.  It is not usually nec-
  307.      essary to use event numbers, but the current event number can be made
  308.      part of the _✓p_✓r_✓o_✓m_✓p_✓t by placing an `!' in the prompt string.
  309.  
  310.      With the current event 13 we can refer to previous events by event number
  311.      `!11', relatively as in `!-2' (referring to the same event), by a prefix
  312.      of a command word as in `!d' for event 12 or `!wri' for event 9, or by a
  313.      string contained in a word in the command as in `!?mic?' also referring
  314.      to event 9.  These forms, without further modification, simply reintro-
  315.      duce the words of the specified events, each separated by a single blank.
  316.      As a special case `!!' refers to the previous command; thus `!!'  alone
  317.      is essentially a _✓r_✓e_✓d_✓o.
  318.  
  319.      To select words from an event we can follow the event specification by a
  320.      `:' and a designator for the desired words.  The words of an input line
  321.      are numbered from 0, the first (usually command) word being 0, the second
  322.      word (first argument) being 1, etc.  The basic word designators are:
  323.  
  324.            0       first (command) word
  325.            _✓n       _✓n'th argument
  326.            ^       first argument,  i.e. `1'
  327.            $       last argument
  328.            %       word matched by (immediately preceding)
  329.  
  330.                    ?_✓s.             rm S0 search
  331.            _✓x_✓-_✓y     range of words
  332.            _✓-_✓y      abbreviates _✓`_✓0_✓-_✓y_✓'
  333.            *       abbreviates `^-$', or nothing if only 1 word in event
  334.            _✓x_✓*      abbreviates _✓`_✓x_✓-_✓$_✓'
  335.            _✓x_✓-      like _✓`_✓x_✓*_✓' but omitting word `$'
  336.  
  337.      The `:' separating the event specification from the word designator can
  338.      be omitted if the argument selector begins with a `^', `$', `*' `-' or
  339.      `%'.  After the optional word designator can be placed a sequence of mod-
  340.      ifiers, each preceded by a `:'.  The following modifiers are defined:
  341.  
  342.            h       Remove a trailing pathname component, leaving the head.
  343.            r       Remove a trailing `.xxx' component, leaving the root name.
  344.            e       Remove all but the extension `.xxx' part.
  345.            s_✓/_✓l_✓/_✓r_✓/  Substitute _✓l for _✓r
  346.            t       Remove all leading pathname components, leaving the tail.
  347.            &       Repeat the previous substitution.
  348.            g       Apply the change globally, prefixing the above, e.g. `g&'.
  349.            p       Print the new command line but do not execute it.
  350.            q       Quote the substituted words, preventing further substitu-
  351.                    tions.
  352.            x       Like q, but break into words at blanks, tabs and newlines.
  353.  
  354.      Unless preceded by a `g' the modification is applied only to the first
  355.      modifiable word.  With substitutions, it is an error for no word to be
  356.      applicable.
  357.  
  358.      The left hand side of substitutions are not regular expressions in the
  359.      sense of the editors, but rather strings.  Any character may be used as
  360.      the delimiter in place of `/'; a `\' quotes the delimiter into the _✓l and
  361.      _✓r strings.  The character `&' in the right hand side is replaced by the
  362.      text from the left.  A `\' quotes `&' also.  A null _✓l (" ") uses the pre-
  363.      vious string either from a _✓l or from a contextual scan string _✓s in `!?  _✓s
  364.      The trailing delimiter in the substitution may be omitted if a newline
  365.      follows immediately as may the trailing `?' in a contextual scan.
  366.  
  367.      A history reference may be given without an event specification, e.g.
  368.      `!$'.  In this case the reference is to the previous command unless a
  369.      previous history reference occurred on the same line in which case this
  370.      form repeats the previous reference.  Thus `!?foo?^ !$' gives the first
  371.      and last arguments from the command matching `?foo?'.
  372.  
  373.      A special abbreviation of a history reference occurs when the first non-
  374.      blank character of an input line is a `^'.  This is equivalent to `!:s^'
  375.      providing a convenient shorthand for substitutions on the text of the
  376.      previous line.  Thus `^lb^lib' fixes the spelling of `lib' in the previ-
  377.      ous command.  Finally, a history substitution may be surrounded with `{'
  378.      and `}' if necessary to insulate it from the characters which follow.
  379.      Thus, after `ls -ld ~paul' we might do `!{l}a' to do `ls -ld ~paula',
  380.      while `!la' would look for a command starting `la'.
  381.  
  382.    Q✓Qu✓uo✓ot✓ta✓at✓ti✓io✓on✓ns✓s w✓wi✓it✓th✓h '✓' a✓an✓nd✓d "✓"
  383.      The quotation of strings by `'' and `"' can be used to prevent all or
  384.      some of the remaining substitutions.  Strings enclosed in `'' are pre-
  385.      vented any further interpretation.  Strings enclosed in `"' may be ex-
  386.      panded as described below.
  387.  
  388.      In both cases the resulting text becomes (all or part of) a single word;
  389.      only in one special case (see _✓C_✓o_✓m_✓m_✓a_✓n_✓d _✓S_✓u_✓b_✓s_✓t_✓i_✓t_✓i_✓t_✓i_✓o_✓n below) does a `"'
  390.      quoted string yield parts of more than one word; `'' quoted strings never
  391.      do.
  392.  
  393.    A✓Al✓li✓ia✓as✓s s✓su✓ub✓bs✓st✓ti✓it✓tu✓ut✓ti✓io✓on✓n
  394.      The shell maintains a list of aliases which can be established, displayed
  395.      and modified by the _✓a_✓l_✓i_✓a_✓s and _✓u_✓n_✓a_✓l_✓i_✓a_✓s commands.  After a command line is
  396.      scanned, it is parsed into distinct commands and the first word of each
  397.      command, left-to-right, is checked to see if it has an alias.  If it
  398.      does, then the text which is the alias for that command is reread with
  399.      the history mechanism available as though that command were the previous
  400.      input line.  The resulting words replace the command and argument list.
  401.      If no reference is made to the history list, then the argument list is
  402.      left unchanged.
  403.  
  404.      Thus if the alias for `ls' is `ls -l' the command `ls /usr' would map to
  405.      `ls -l /usr', the argument list here being undisturbed.  Similarly if the
  406.      alias for `lookup' was `grep !^ /etc/passwd' then `lookup bill' would map
  407.      to `grep bill /etc/passwd'.
  408.  
  409.      If an alias is found, the word transformation of the input text is per-
  410.      formed and the aliasing process begins again on the reformed input line.
  411.      Looping is prevented if the first word of the new text is the same as the
  412.      old by flagging it to prevent further aliasing.  Other loops are detected
  413.      and cause an error.
  414.  
  415.      Note that the mechanism allows aliases to introduce parser metasyntax.
  416.      Thus we can `alias print 'pr \!* | lpr'' to make a command which _✓p_✓r _✓'_✓s
  417.      its arguments to the line printer.
  418.  
  419.    V✓Va✓ar✓ri✓ia✓ab✓bl✓le✓e s✓su✓ub✓bs✓st✓ti✓it✓tu✓ut✓ti✓io✓on✓n
  420.      The shell maintains a set of variables, each of which has as value a list
  421.      of zero or more words.  Some of these variables are set by the shell or
  422.      referred to by it.  For instance, the _✓a_✓r_✓g_✓v variable is an image of the
  423.      shell's argument list, and words of this variable's value are referred to
  424.      in special ways.
  425.  
  426.      The values of variables may be displayed and changed by using the _✓s_✓e_✓t and
  427.      _✓u_✓n_✓s_✓e_✓t commands.  Of the variables referred to by the shell a number are
  428.      toggles; the shell does not care what their value is, only whether they
  429.      are set or not.  For instance, the _✓v_✓e_✓r_✓b_✓o_✓s_✓e variable is a toggle which
  430.      causes command input to be echoed.  The setting of this variable results
  431.      from the -✓-v✓v command line option.
  432.  
  433.      Other operations treat variables numerically.  The `@' command permits
  434.      numeric calculations to be performed and the result assigned to a vari-
  435.      able.  Variable values are, however, always represented as (zero or more)
  436.      strings.  For the purposes of numeric operations, the null string is con-
  437.      sidered to be zero, and the second and subsequent words of multiword val-
  438.      ues are ignored.
  439.  
  440.      After the input line is aliased and parsed, and before each command is
  441.      executed, variable substitution is performed keyed by `$' characters.
  442.      This expansion can be prevented by preceding the `$' with a `\' except
  443.      within `"'s where it _✓a_✓l_✓w_✓a_✓y_✓s occurs, and within `''s where it _✓n_✓e_✓v_✓e_✓r oc-
  444.      curs.  Strings quoted by ``' are interpreted later (see C✓Co✓om✓mm✓ma✓an✓nd✓d
  445.      s✓su✓ub✓bs✓st✓ti✓it✓tu✓ut✓ti✓io✓on✓n below) so `$' substitution does not occur there until later,
  446.      if at all.  A `$' is passed unchanged if followed by a blank, tab, or
  447.      end-of-line.
  448.  
  449.      Input/output redirections are recognized before variable expansion, and
  450.      are variable expanded separately.  Otherwise, the command name and entire
  451.      argument list are expanded together.  It is thus possible for the first
  452.      (command) word to this point to generate more than one word, the first of
  453.      which becomes the command name, and the rest of which become arguments.
  454.  
  455.      Unless enclosed in `"' or given the `:q' modifier the results of variable
  456.      substitution may eventually be command and filename substituted.  Within
  457.      `"', a variable whose value consists of multiple words expands to a (por-
  458.      tion of) a single word, with the words of the variables value separated
  459.      by blanks.  When the `:q' modifier is applied to a substitution the vari-
  460.      able will expand to multiple words with each word separated by a blank
  461.      and quoted to prevent later command or filename substitution.
  462.  
  463.      The following metasequences are provided for introducing variable values
  464.      into the shell input.  Except as noted, it is an error to reference a
  465.      variable which is not set.
  466.  
  467.            $name
  468.            ${name}
  469.                    Are replaced by the words of the value of variable _✓n_✓a_✓m_✓e,
  470.                    each separated by a blank.  Braces insulate _✓n_✓a_✓m_✓e from fol-
  471.                    lowing characters which would otherwise be part of it.
  472.                    Shell variables have names consisting of up to 20 letters
  473.                    and digits starting with a letter.  The underscore charac-
  474.                    ter is considered a letter.
  475.                    If _✓n_✓a_✓m_✓e is not a shell variable, but is set in the environ-
  476.                    ment, then that value is returned (but : modifiers and the
  477.                    other forms given below are not available in this case).
  478.            $name[selector]
  479.            ${name[selector}]
  480.                    May be used to select only some of the words from the value
  481.                    of _✓n_✓a_✓m_✓e. The selector is subjected to `$' substitution and
  482.                    may consist of a single number or two numbers separated by
  483.                    a `-'.  The first word of a variables value is numbered
  484.                    `1'.  If the first number of a range is omitted it defaults
  485.                    to `1'.  If the last member of a range is omitted it de-
  486.                    faults to `$#name'.  The selector `*' selects all words.
  487.                    It is not an error for a range to be empty if the second
  488.                    argument is omitted or in range.
  489.            $#name
  490.            ${#name}
  491.                    Gives the number of words in the variable.  This is useful
  492.                    for later use in a `$argv[selector]'.
  493.            $0      Substitutes the name of the file from which command input
  494.                    is being read.  An error occurs if the name is not known.
  495.            $number
  496.            ${number}
  497.                    Equivalent to `$argv[number]'.
  498.            $*      Equivalent to `$argv[*]'.  The modifiers `:e', `:h', `:t',
  499.                    `:r', `:q' and `:x' may be applied to the substitutions
  500.                    above as may `:gh', `:gt' and `:gr'.  If braces `{' '}' ap-
  501.                    pear in the command form then the modifiers must appear
  502.                    within the braces.  The current implementation allows only
  503.                    one `:' modifier on each `$' expansion.
  504.  
  505.      The following substitutions may not be modified with `:' modifiers.
  506.            $?name
  507.            ${?name}
  508.                    Substitutes the string `1' if name is set, `0' if it is
  509.                    not.
  510.            $?0     Substitutes `1' if the current input filename is known, `0'
  511.                    if it is not.
  512.                    Substitute the (decimal) process number of the (parent)
  513.                    shell.
  514.            $<      Substitutes a line from the standard input, with no further
  515.                    interpretation thereafter.  It can be used to read from the
  516.                    keyboard in a shell script.
  517.  
  518.    C✓Co✓om✓mm✓ma✓an✓nd✓d a✓an✓nd✓d f✓fi✓il✓le✓en✓na✓am✓me✓e s✓su✓ub✓bs✓st✓ti✓it✓tu✓ut✓ti✓io✓on✓n
  519.      The remaining substitutions, command and filename substitution, are ap-
  520.      plied selectively to the arguments of builtin commands.  This means that
  521.      portions of expressions which are not evaluated are not subjected to
  522.      these expansions.  For commands which are not internal to the shell, the
  523.      command name is substituted separately from the argument list.  This oc-
  524.      curs very late, after input-output redirection is performed, and in a
  525.      child of the main shell.
  526.  
  527.  
  528.    C✓Co✓om✓mm✓ma✓an✓nd✓d s✓su✓ub✓bs✓st✓ti✓it✓tu✓ut✓ti✓io✓on✓n
  529.      Command substitution is indicated by a command enclosed in ``'.  The out-
  530.      put from such a command is normally broken into separate words at blanks,
  531.      tabs and newlines, with null words being discarded, this text then re-
  532.      placing the original string.  Within `"'s, only newlines force new words;
  533.      blanks and tabs are preserved.
  534.  
  535.      In any case, the single final newline does not force a new word.  Note
  536.      that it is thus possible for a command substitution to yield only part of
  537.      a word, even if the command outputs a complete line.
  538.  
  539.    F✓Fi✓il✓le✓en✓na✓am✓me✓e s✓su✓ub✓bs✓st✓ti✓it✓tu✓ut✓ti✓io✓on✓n
  540.      If a word contains any of the characters `*', `?', `[' or `{' or begins
  541.      with the character `~', then that word is a candidate for filename sub-
  542.      stitution, also known as `globbing'.  This word is then regarded as a
  543.      pattern, and replaced with an alphabetically sorted list of file names
  544.      which match the pattern.  In a list of words specifying filename substi-
  545.      tution it is an error for no pattern to match an existing file name, but
  546.      it is not required for each pattern to match.  Only the metacharacters
  547.      `*', `?' and `[' imply pattern matching, the characters `~' and `{' being
  548.      more akin to abbreviations.
  549.  
  550.      In matching filenames, the character `.' at the beginning of a filename
  551.      or immediately following a `/', as well as the character `/' must be
  552.      matched explicitly.  The character `*' matches any string of characters,
  553.      including the null string.  The character `?' matches any single charac-
  554.      ter.  The sequence `[...]' matches any one of the characters enclosed.
  555.      Within `[...]', a pair of characters separated by `-' matches any charac-
  556.      ter lexically between the two.
  557.  
  558.      The character `~' at the beginning of a filename is used to refer to home
  559.      directories.  Standing alone, i.e. `~' it expands to the invokers home
  560.      directory as reflected in the value of the variable _✓h_✓o_✓m_✓e. When followed
  561.      by a name consisting of letters, digits and `-' characters the shell
  562.      searches for a user with that name and substitutes their home directory;
  563.      thus `~ken' might expand to `/usr/ken' and `~ken/chmach' to
  564.      `/usr/ken/chmach'.  If the character `~' is followed by a character other
  565.      than a letter or `/' or appears not at the beginning of a word, it is
  566.      left undisturbed.
  567.  
  568.      The metanotation `a{b,c,d}e' is a shorthand for `abe ace ade'.  Left to
  569.      right order is preserved, with results of matches being sorted separately
  570.      at a low level to preserve this order.  This construct may be nested.
  571.      Thus `~source/s1/{oldls,ls}.c' expands to `/usr/source/s1/oldls.c
  572.      /usr/source/s1/ls.c' whether or not these files exist without any chance
  573.      of error if the home directory for `source' is `/usr/source'.  Similarly
  574.      `../{memo,*box}' might expand to `../memo ../box ../mbox'.  (Note that
  575.      `memo' was not sorted with the results of matching `*box'.)  As a special
  576.      case `{', `}' and `{}' are passed undisturbed.
  577.  
  578.    I✓In✓np✓pu✓ut✓t/✓/o✓ou✓ut✓tp✓pu✓ut✓t
  579.      The standard input and standard output of a command may be redirected
  580.      with the following syntax:
  581.  
  582.            < name  Open file _✓n_✓a_✓m_✓e (which is first variable, command and file-
  583.                    name expanded) as the standard input.
  584.            << word
  585.                    Read the shell input up to a line which is identical to
  586.                    _✓w_✓o_✓r_✓d. _✓W_✓o_✓r_✓d is not subjected to variable, filename or com-
  587.                    mand substitution, and each input line is compared to _✓w_✓o_✓r_✓d
  588.                    before any substitutions are done on this input line.  Un-
  589.                    less a quoting `\', `"', `' or ``' appears in _✓w_✓o_✓r_✓d variable
  590.                    and command substitution is performed on the intervening
  591.                    lines, allowing `\' to quote `$', `\' and ``'.  Commands
  592.                    which are substituted have all blanks, tabs, and newlines
  593.                    preserved, except for the final newline which is dropped.
  594.                    The resultant text is placed in an anonymous temporary file
  595.                    which is given to the command as standard input.
  596.            > name
  597.            >! name
  598.            >& name
  599.            >&! name
  600.                    The file _✓n_✓a_✓m_✓e is used as standard output.  If the file does
  601.                    not exist then it is created; if the file exists, its is
  602.                    truncated, its previous contents being lost.
  603.  
  604.                    If the variable _✓n_✓o_✓c_✓l_✓o_✓b_✓b_✓e_✓r is set, then the file must not
  605.                    exist or be a character special file (e.g. a terminal or
  606.                    `/dev/null') or an error results.  This helps prevent acci-
  607.                    dental destruction of files.  In this case the `!' forms
  608.                    can be used and suppress this check.
  609.  
  610.                    The forms involving `&' route the diagnostic output into
  611.                    the specified file as well as the standard output.  _✓N_✓a_✓m_✓e is
  612.                    expanded in the same way as `<' input filenames are.
  613.            >> name
  614.            >>& name
  615.            >>! name
  616.            >>&! name
  617.                    Uses file _✓n_✓a_✓m_✓e as standard output like `>' but places out-
  618.                    put at the end of the file.  If the variable _✓n_✓o_✓c_✓l_✓o_✓b_✓b_✓e_✓r is
  619.                    set, then it is an error for the file not to exist unless
  620.                    one of the `!' forms is given.  Otherwise similar to `>'.
  621.  
  622.      A command receives the environment in which the shell was invoked as mod-
  623.      ified by the input-output parameters and the presence of the command in a
  624.      pipeline.  Thus, unlike some previous shells, commands run from a file of
  625.      shell commands have no access to the text of the commands by default;
  626.      rather they receive the original standard input of the shell.  The `<<'
  627.      mechanism should be used to present inline data.  This permits shell com-
  628.      mand scripts to function as components of pipelines and allows the shell
  629.      to block read its input.  Note that the default standard input for a com-
  630.      mand run detached is _✓n_✓o_✓t modified to be the empty file _✓/_✓d_✓e_✓v_✓/_✓n_✓u_✓l_✓l; rather
  631.      the standard input remains as the original standard input of the shell.
  632.      If this is a terminal and if the process attempts to read from the termi-
  633.      nal, then the process will block and the user will be notified (see _✓J_✓o_✓b_✓s
  634.      above).
  635.  
  636.      Diagnostic output may be directed through a pipe with the standard out-
  637.      put.  Simply use the form `|&' rather than just `|'.
  638.  
  639.    E✓Ex✓xp✓pr✓re✓es✓ss✓si✓io✓on✓ns✓s
  640.      A number of the builtin commands (to be described subsequently) take ex-
  641.      pressions, in which the operators are similar to those of C, with the
  642.      same precedence.  These expressions appear in the @✓@,✓, _✓e_✓x_✓i_✓t, _✓i_✓f, and _✓w_✓h_✓i_✓l_✓e
  643.      commands.  The following operators are available:
  644.  
  645.            ||  &&  | *(ua  &  ==  !=  =~  !~  <=  >= <  > <<  >>  +  -  *  /
  646.            %  !  ~  (  )
  647.  
  648.      Here the precedence increases to the right, `==' `!=' `=~' and `!~', `<='
  649.      `>=' `<' and `>', `<<' and `>>', `+' and `-', `*' `/' and `%' being, in
  650.      groups, at the same level.  The `==' `!=' `=~' and `!~' operators compare
  651.      their arguments as strings; all others operate on numbers.  The operators
  652.      `=~' and `!~' are like `!=' and `==' except that the right hand side is a
  653.      _✓p_✓a_✓t_✓t_✓e_✓r_✓n (containing, e.g. `*'s, `?'s and instances of `[...]'  against
  654.      which the left hand operand is matched.  This reduces the need for use of
  655.      the _✓s_✓w_✓i_✓t_✓c_✓h statement in shell scripts when all that is really needed is
  656.      pattern matching.
  657.  
  658.      Strings which begin with `0' are considered octal numbers.  Null or miss-
  659.      ing arguments are considered `0'.  The result of all expressions are
  660.      strings, which represent decimal numbers.  It is important to note that
  661.      no two components of an expression can appear in the same word; except
  662.      when adjacent to components of expressions which are syntactically sig-
  663.      nificant to the parser (`&' `|' `<' `>' `(' `)') they should be surround-
  664.      ed by spaces.
  665.  
  666.      Also available in expressions as primitive operands are command execu-
  667.      tions enclosed in `{' and `}' and file enquiries of the form -✓-l✓l _✓n_✓a_✓m_✓e
  668.      where l✓l is one of:
  669.  
  670.            r    read access w    write access x    execute access e    exis-
  671.            tence o    ownership z    zero size f    plain file d    directory
  672.  
  673.      The specified name is command and filename expanded and then tested to
  674.      see if it has the specified relationship to the real user.  If the file
  675.      does not exist or is inaccessible then all enquiries return false, i.e.
  676.      `0'.  Command executions succeed, returning true, i.e. `1', if the com-
  677.      mand exits with status 0, otherwise they fail, returning false, i.e. `0'.
  678.      If more detailed status information is required then the command should
  679.      be executed outside of an expression and the variable _✓s_✓t_✓a_✓t_✓u_✓s examined.
  680.  
  681.    C✓Co✓on✓nt✓tr✓ro✓ol✓l f✓fl✓lo✓ow✓w
  682.      The shell contains a number of commands which can be used to regulate the
  683.      flow of control in command files (shell scripts) and (in limited but use-
  684.      ful ways) from terminal input.  These commands all operate by forcing the
  685.      shell to reread or skip in its input and, due to the implementation, re-
  686.      strict the placement of some of the commands.
  687.  
  688.      The f✓fo✓or✓re✓ea✓ac✓ch✓h, s✓sw✓wi✓it✓tc✓ch✓h, and w✓wh✓hi✓il✓le✓e statements, as well as the i✓if✓f-✓-t✓th✓he✓en✓n-✓-e✓el✓ls✓se✓e
  689.      form of the i✓if✓f statement require that the major keywords appear in a sin-
  690.      gle simple command on an input line as shown below.
  691.  
  692.      If the shell's input is not seekable, the shell buffers up input whenever
  693.      a loop is being read and performs seeks in this internal buffer to accom-
  694.      plish the rereading implied by the loop.  (To the extent that this al-
  695.      lows, backward goto's will succeed on non-seekable inputs.)
  696.  
  697.    B✓Bu✓ui✓il✓lt✓ti✓in✓n c✓co✓om✓mm✓ma✓an✓nd✓ds✓s
  698.      Builtin commands are executed within the shell.  If a builtin command oc-
  699.      curs as any component of a pipeline except the last then it is executed
  700.      in a subshell.
  701.  
  702.            a✓al✓li✓ia✓as✓s
  703.            a✓al✓li✓ia✓as✓s _✓n_✓a_✓m_✓e
  704.            a✓al✓li✓ia✓as✓s _✓n_✓a_✓m_✓e _✓w_✓o_✓r_✓d_✓l_✓i_✓s_✓t
  705.                    The first form prints all aliases.  The second form prints
  706.                    the alias for name.  The final form assigns the specified
  707.                    _✓w_✓o_✓r_✓d_✓l_✓i_✓s_✓t as the alias of _✓n_✓a_✓m_✓e; _✓w_✓o_✓r_✓d_✓l_✓i_✓s_✓t is command and
  708.                    filename substituted.  _✓N_✓a_✓m_✓e is not allowed to be _✓a_✓l_✓i_✓a_✓s or
  709.                    _✓u_✓n_✓a_✓l_✓i_✓a_✓s.
  710.  
  711.            a✓al✓ll✓lo✓oc✓c   Shows the amount of dynamic memory acquired, broken down
  712.                    into used and free memory.  With an argument shows the num-
  713.                    ber of free and used blocks in each size category.  The
  714.                    categories start at size 8 and double at each step.  This
  715.                    command's output may vary across system types, since sys-
  716.                    tems other than the VAX may use a different memory alloca-
  717.                    tor.
  718.  
  719.            b✓bg✓g
  720.            b✓bg✓g %✓%_✓j_✓o_✓b _✓._✓._✓.
  721.                    Puts the current or specified jobs into the background,
  722.                    continuing them if they were stopped.
  723.  
  724.  
  725.  
  726.            b✓br✓re✓ea✓ak✓k   Causes execution to resume after the e✓en✓nd✓d of the nearest en-
  727.                    closing f✓fo✓or✓re✓ea✓ac✓ch✓h or w✓wh✓hi✓il✓le✓e. The remaining commands on the
  728.                    current line are executed.  Multi-level breaks are thus
  729.                    possible by writing them all on one line.
  730.  
  731.            b✓br✓re✓ea✓ak✓ks✓sw✓w
  732.                    Causes a break from a s✓sw✓wi✓it✓tc✓ch✓h, resuming after the e✓en✓nd✓ds✓sw✓w.
  733.  
  734.            c✓ca✓as✓se✓e _✓l_✓a_✓b_✓e_✓l:
  735.                    A label in a s✓sw✓wi✓it✓tc✓ch✓h statement as discussed below.
  736.  
  737.            c✓cd✓d
  738.            c✓cd✓d _✓n_✓a_✓m_✓e
  739.            c✓ch✓hd✓di✓ir✓r
  740.            c✓ch✓hd✓di✓ir✓r _✓n_✓a_✓m_✓e
  741.                    Change the shell's working directory to directory _✓n_✓a_✓m_✓e. If
  742.                    no argument is given then change to the home directory of
  743.                    the user.  If _✓n_✓a_✓m_✓e is not found as a subdirectory of the
  744.                    current directory (and does not begin with `/', `./' or
  745.                    `../'), then each component of the variable c✓cd✓dp✓pa✓at✓th✓h is
  746.                    checked to see if it has a subdirectory _✓n_✓a_✓m_✓e. Finally, if
  747.                    all else fails but _✓n_✓a_✓m_✓e is a shell variable whose value be-
  748.                    gins with `/', then this is tried to see if it is a direc-
  749.                    tory.
  750.  
  751.            c✓co✓on✓nt✓ti✓in✓nu✓ue✓e
  752.                    Continue execution of the nearest enclosing w✓wh✓hi✓il✓le✓e or
  753.                    f✓fo✓or✓re✓ea✓ac✓ch✓h. The rest of the commands on the current line are
  754.                    executed.
  755.  
  756.            d✓de✓ef✓fa✓au✓ul✓lt✓t:
  757.                    Labels the default case in a s✓sw✓wi✓it✓tc✓ch✓h statement.  The default
  758.                    should come after all c✓ca✓as✓se✓e labels.
  759.  
  760.            d✓di✓ir✓rs✓s    Prints the directory stack; the top of the stack is at the
  761.                    left, the first directory in the stack being the current
  762.                    directory.
  763.  
  764.            e✓ec✓ch✓ho✓o _✓w_✓o_✓r_✓d_✓l_✓i_✓s_✓t
  765.            e✓ec✓ch✓ho✓o -✓-n✓n _✓w_✓o_✓r_✓d_✓l_✓i_✓s_✓t
  766.                    The specified words are written to the shells standard out-
  767.                    put, separated by spaces, and terminated with a newline un-
  768.                    less the -✓-n✓n option is specified.
  769.  
  770.            e✓el✓ls✓se✓e
  771.            e✓en✓nd✓d
  772.            e✓en✓nd✓di✓if✓f
  773.            e✓en✓nd✓ds✓sw✓w   See the description of the f✓fo✓or✓re✓ea✓ac✓ch✓h, i✓if✓f, s✓sw✓wi✓it✓tc✓ch✓h, and w✓wh✓hi✓il✓le✓e
  774.                    statements below.
  775.  
  776.            e✓ev✓va✓al✓l _✓a_✓r_✓g _✓._✓._✓.
  777.                    (As in sh(1).)  The arguments are read as input to the
  778.                    shell and the resulting command(s) executed in the context
  779.                    of the current shell.  This is usually used to execute com-
  780.                    mands generated as the result of command or variable sub-
  781.                    stitution, since parsing occurs before these substitutions.
  782.                    See tset(1) for an example of using e✓ev✓va✓al✓l.
  783.  
  784.            e✓ex✓xe✓ec✓c _✓c_✓o_✓m_✓m_✓a_✓n_✓d
  785.                    The specified command is executed in place of the current
  786.                    shell.
  787.  
  788.            e✓ex✓xi✓it✓t
  789.            e✓ex✓xi✓it✓t _✓(_✓e_✓x_✓p_✓r)
  790.                    The shell exits either with the value of the s✓st✓ta✓at✓tu✓us✓s vari-
  791.                    able (first form) or with the value of the specified e✓ex✓xp✓pr✓r
  792.                    (second form).
  793.  
  794.            f✓fg✓g
  795.            f✓fg✓g %✓% _✓j_✓o_✓b _✓._✓._✓.
  796.                    Brings the current or specified jobs into the foreground,
  797.                    continuing them if they were stopped.
  798.  
  799.            f✓fo✓or✓re✓ea✓ac✓ch✓h _✓n_✓a_✓m_✓e _✓(_✓w_✓o_✓r_✓d_✓l_✓i_✓s_✓t_✓)
  800.            ...
  801.            e✓en✓nd✓d     The variable n✓na✓am✓me✓e is successively set to each member of
  802.                    w✓wo✓or✓rd✓dl✓li✓is✓st✓t and the sequence of commands between this command
  803.                    and the matching e✓en✓nd✓d are executed.  (Both f✓fo✓or✓re✓ea✓ac✓ch✓h and e✓en✓nd✓d
  804.                    must appear alone on separate lines.)  The builtin command
  805.                    c✓co✓on✓nt✓ti✓in✓nu✓ue✓e may be used to continue the loop prematurely and
  806.                    the builtin command b✓br✓re✓ea✓ak✓k to terminate it prematurely.
  807.                    When this command is read from the terminal, the loop is
  808.                    read up once prompting with `?' before any statements in
  809.                    the loop are executed.  If you make a mistake typing in a
  810.                    loop at the terminal you can rub it out.
  811.  
  812.            g✓gl✓lo✓ob✓b _✓w_✓o_✓r_✓d_✓l_✓i_✓s_✓t
  813.                    Like e✓ec✓ch✓ho✓o but no `\' escapes are recognized and words are
  814.                    delimited by null characters in the output.  Useful for
  815.                    programs which wish to use the shell to filename expand a
  816.                    list of words.
  817.  
  818.            g✓go✓ot✓to✓o _✓w_✓o_✓r_✓d
  819.                    The specified w✓wo✓or✓rd✓d is filename and command expanded to
  820.                    yield a string of the form `label'.  The shell rewinds its
  821.                    input as much as possible and searches for a line of the
  822.                    form `label:' possibly preceded by blanks or tabs.  Execu-
  823.                    tion continues after the specified line.
  824.  
  825.            h✓ha✓as✓sh✓hs✓st✓ta✓at✓t
  826.                    Print a statistics line indicating how effective the inter-
  827.                    nal hash table has been at locating commands (and avoiding
  828.                    e✓ex✓xe✓ec✓c's). An e✓ex✓xe✓ec✓c is attempted for each component of the
  829.                    _✓p_✓a_✓t_✓h where the hash function indicates a possible hit, and
  830.                    in each component which does not begin with a `/'.
  831.  
  832.            h✓hi✓is✓st✓to✓or✓ry✓y
  833.            h✓hi✓is✓st✓to✓or✓ry✓y _✓n
  834.            h✓hi✓is✓st✓to✓or✓ry✓y -✓-r✓r _✓n
  835.            h✓hi✓is✓st✓to✓or✓ry✓y -✓-h✓h _✓n
  836.                    Displays the history event list; if _✓n is given only the _✓n
  837.                    most recent events are printed.  The -✓-r✓r option reverses the
  838.                    order of printout to be most recent first rather than old-
  839.                    est first.  The -✓-h✓h option causes the history list to be
  840.                    printed without leading numbers.  This is used to produce
  841.                    files suitable for sourceing using the -h option to s✓so✓ou✓ur✓rc✓ce✓e.
  842.  
  843.            i✓if✓f (_✓e_✓x_✓p_✓r command)
  844.                    If the specified expression evaluates true, then the single
  845.                    _✓c_✓o_✓m_✓m_✓a_✓n_✓d with arguments is executed.  Variable substitution
  846.                    on _✓c_✓o_✓m_✓m_✓a_✓n_✓d happens early, at the same time it does for the
  847.                    rest of the i✓if✓f command.  _✓C_✓o_✓m_✓m_✓a_✓n_✓d must be a simple command,
  848.                    not a pipeline, a command list, or a parenthesized command
  849.                    list.  Input/output redirection occurs even if _✓e_✓x_✓p_✓r is
  850.                    false, when command is n✓no✓ot✓t executed (this is a bug).
  851.  
  852.            i✓if✓f (_✓e_✓x_✓p_✓r) t✓th✓he✓en✓n
  853.            ...
  854.            e✓el✓ls✓se✓e i✓if✓f (_✓e_✓x_✓p_✓r_✓2) t✓th✓he✓en✓n
  855.            ...
  856.  
  857.  
  858.            e✓el✓ls✓se✓e
  859.            ...
  860.            e✓en✓nd✓di✓if✓f   If the specified _✓e_✓x_✓p_✓r is true then the commands to the
  861.                    first e✓el✓ls✓se✓e are executed; otherwise if _✓e_✓x_✓p_✓r_✓2 is true then
  862.                    the commands to the second e✓el✓ls✓se✓e are executed, etc.  Any
  863.                    number of e✓el✓ls✓se✓e-✓-i✓if✓f pairs are possible; only one e✓en✓nd✓di✓if✓f is
  864.                    needed.  The e✓el✓ls✓se✓e part is likewise optional.  (The words
  865.                    e✓el✓ls✓se✓e and e✓en✓nd✓di✓if✓f must appear at the beginning of input lines;
  866.                    the i✓if✓f must appear alone on its input line or after an
  867.                    e✓el✓ls✓se✓e.)
  868.  
  869.            j✓jo✓ob✓bs✓s
  870.            j✓jo✓ob✓bs✓s -✓-l✓l
  871.                    Lists the active jobs; given the -✓-l✓l options lists process
  872.                    id's in addition to the normal information.
  873.  
  874.            k✓ki✓il✓ll✓l %✓% _✓j_✓o_✓b
  875.            k✓ki✓il✓ll✓l _✓p_✓i_✓d
  876.            k✓ki✓il✓ll✓l -✓-s✓si✓ig✓g _✓p_✓i_✓d _✓._✓._✓.
  877.            k✓ki✓il✓ll✓l -✓-l✓l
  878.                    Sends either the TERM (terminate) signal or the specified
  879.                    signal to the specified jobs or processes.  Signals are ei-
  880.                    ther given by number or by names (as given in
  881.                    _✓/_✓u_✓s_✓r_✓/_✓i_✓n_✓c_✓l_✓u_✓d_✓e_✓/_✓s_✓i_✓g_✓n_✓a_✓l_✓._✓h_✓, stripped of the prefix ``SIG'').
  882.                    The signal names are listed by ``kill -l''.  There is no
  883.                    default, saying just `kill' does not send a signal to the
  884.                    current job.  If the signal being sent is TERM (terminate)
  885.                    or HUP (hangup), then the job or process will be sent a
  886.                    CONT (continue) signal as well.
  887.  
  888.            l✓li✓im✓mi✓it✓t
  889.            l✓li✓im✓mi✓it✓t _✓r_✓e_✓s_✓o_✓u_✓r_✓c_✓e
  890.            l✓li✓im✓mi✓it✓t _✓r_✓e_✓s_✓o_✓u_✓r_✓c_✓e _✓m_✓a_✓x_✓i_✓m_✓u_✓m_✓-_✓u_✓s_✓e
  891.            l✓li✓im✓mi✓it✓t -✓-h✓h
  892.            l✓li✓im✓mi✓it✓t -✓-h✓h _✓r_✓e_✓s_✓o_✓u_✓r_✓c_✓e
  893.            l✓li✓im✓mi✓it✓t -✓-h✓h _✓r_✓e_✓s_✓o_✓u_✓r_✓c_✓e _✓m_✓a_✓x_✓i_✓m_✓u_✓m_✓-_✓u_✓s_✓e
  894.                    Limits the consumption by the current process and each pro-
  895.                    cess it creates to not individually exceed _✓m_✓a_✓x_✓i_✓m_✓u_✓m_✓-_✓u_✓s_✓e on
  896.                    the specified _✓r_✓e_✓s_✓o_✓u_✓r_✓c_✓e. If no _✓m_✓a_✓x_✓i_✓m_✓u_✓m_✓-_✓u_✓s_✓e is given, then
  897.                    the current limit is printed; if no _✓r_✓e_✓s_✓o_✓u_✓r_✓c_✓e is given, then
  898.                    all limitations are given.  If the -✓-h✓h flag is given, the
  899.                    hard limits are used instead of the current limits.  The
  900.                    hard limits impose a ceiling on the values of the current
  901.                    limits.  Only the super-user may raise the hard limits, but
  902.                    a user may lower or raise the current limits within the le-
  903.                    gal range.
  904.  
  905.                    Resources controllable currently include _✓c_✓p_✓u_✓t_✓i_✓m_✓e (the maxi-
  906.                    mum number of cpu-seconds to be used by each process),
  907.                    _✓f_✓i_✓l_✓e_✓s_✓i_✓z_✓e (the largest single file which can be created),
  908.                    _✓d_✓a_✓t_✓a_✓s_✓i_✓z_✓e (the maximum growth of the data+stack region via
  909.                    sbrk(2) beyond the end of the program text), _✓s_✓t_✓a_✓c_✓k_✓s_✓i_✓z_✓e (the
  910.                    maximum size of the automatically-extended stack region),
  911.                    and _✓c_✓o_✓r_✓e_✓d_✓u_✓m_✓p_✓s_✓i_✓z_✓e (the size of the largest core dump that
  912.                    will be created).
  913.  
  914.                    The _✓m_✓a_✓x_✓i_✓m_✓u_✓m_✓-_✓u_✓s_✓e may be given as a (floating point or inte-
  915.                    ger) number followed by a scale factor.  For all limits
  916.                    other than _✓c_✓p_✓u_✓t_✓i_✓m_✓e the default scale is `k' or `kilobytes'
  917.                    (1024 bytes); a scale factor of `m' or `megabytes' may also
  918.                    be used.  For _✓c_✓p_✓u_✓t_✓i_✓m_✓e the default scaling is `seconds',
  919.                    while `m' for minutes or `h' for hours, or a time of the
  920.                    form `mm:ss' giving minutes and seconds may be used.
  921.  
  922.                    For both _✓r_✓e_✓s_✓o_✓u_✓r_✓c_✓e names and scale factors, unambiguous pre-
  923.                    fixes of the names suffice.
  924.  
  925.            l✓lo✓og✓gi✓in✓n   Terminate a login shell, replacing it with an instance of
  926.                    _✓/_✓b_✓i_✓n_✓/_✓l_✓o_✓g_✓i_✓n_✓. This is one way to log off, included for com-
  927.                    patibility with sh(1).
  928.  
  929.            l✓lo✓og✓go✓ou✓ut✓t  Terminate a login shell.  Especially useful if i✓ig✓gn✓no✓or✓re✓ee✓eo✓of✓f is
  930.                    set.
  931.  
  932.            n✓ni✓ic✓ce✓e
  933.            n✓ni✓ic✓ce✓e _✓+_✓n_✓u_✓m_✓b_✓e_✓r
  934.            n✓ni✓ic✓ce✓e _✓c_✓o_✓m_✓m_✓a_✓n_✓d
  935.            n✓ni✓ic✓ce✓e _✓+_✓n_✓u_✓m_✓b_✓e_✓r _✓c_✓o_✓m_✓m_✓a_✓n_✓d
  936.                    The first form sets the scheduling priority for this shell
  937.                    to 4.  The second form sets the priority to the given
  938.                    _✓n_✓u_✓m_✓b_✓e_✓r. The final two forms run command at priority 4 and
  939.                    _✓n_✓u_✓m_✓b_✓e_✓r respectively.  The greater the number, the less cpu
  940.                    the process will get.  The super-user may specify negative
  941.                    priority by using `nice -number ...'.  Command is always
  942.                    executed in a sub-shell, and the restrictions placed on
  943.                    commands in simple i✓if✓f statements apply.
  944.  
  945.            n✓no✓oh✓hu✓up✓p
  946.            n✓no✓oh✓hu✓up✓p _✓c_✓o_✓m_✓m_✓a_✓n_✓d
  947.                    The first form can be used in shell scripts to cause
  948.                    hangups to be ignored for the remainder of the script.  The
  949.                    second form causes the specified command to be run with
  950.                    hangups ignored.  All processes detached with `&' are ef-
  951.                    fectively n✓no✓oh✓hu✓up✓p'ed.
  952.  
  953.            n✓no✓ot✓ti✓if✓fy✓y
  954.            n✓no✓ot✓ti✓if✓fy✓y %✓% _✓j_✓o_✓b _✓._✓._✓.
  955.                    Causes the shell to notify the user asynchronously when the
  956.                    status of the current or specified jobs changes; normally
  957.                    notification is presented before a prompt.  This is auto-
  958.                    matic if the shell variable n✓no✓ot✓ti✓if✓fy✓y is set.
  959.  
  960.            o✓on✓ni✓in✓nt✓tr✓r
  961.            o✓on✓ni✓in✓nt✓tr✓r -✓-
  962.            o✓on✓ni✓in✓nt✓tr✓r _✓l_✓a_✓b_✓e_✓l
  963.                    Control the action of the shell on interrupts.  The first
  964.                    form restores the default action of the shell on interrupts
  965.                    which is to terminate shell scripts or to return to the
  966.                    terminal command input level.  The second form `onintr -'
  967.                    causes all interrupts to be ignored.  The final form causes
  968.                    the shell to execute a `goto label' when an interrupt is
  969.                    received or a child process terminates because it was in-
  970.                    terrupted.
  971.  
  972.                    In any case, if the shell is running detached and inter-
  973.                    rupts are being ignored, all forms of o✓on✓ni✓in✓nt✓tr✓r have no mean-
  974.                    ing and interrupts continue to be ignored by the shell and
  975.                    all invoked commands.
  976.  
  977.            p✓po✓op✓pd✓d
  978.            p✓po✓op✓pd✓d _✓+_✓n
  979.                    Pops the directory stack, returning to the new top directo-
  980.                    ry.  With an argument `+ _✓n' discards the _✓n'th entry in the
  981.                    stack.  The elements of the directory stack are numbered
  982.                    from 0 starting at the top.
  983.  
  984.            p✓pu✓us✓sh✓hd✓d
  985.            p✓pu✓us✓sh✓hd✓d _✓n_✓a_✓m_✓e
  986.            p✓pu✓us✓sh✓hd✓d _✓n
  987.                    With no arguments, p✓pu✓us✓sh✓hd✓d exchanges the top two elements of
  988.                    the directory stack.  Given a _✓n_✓a_✓m_✓e argument, p✓pu✓us✓sh✓hd✓d changes
  989.                    to the new directory (ala c✓cd✓d) and pushes the old current
  990.                    working directory (as in c✓cs✓sw✓w) onto the directory stack.
  991.                    With a numeric argument, rotates the _✓n'th argument of the
  992.                    directory stack around to be the top element and changes to
  993.                    it.  The members of the directory stack are numbered from
  994.                    the top starting at 0.
  995.  
  996.            r✓re✓eh✓ha✓as✓sh✓h  Causes the internal hash table of the contents of the di-
  997.                    rectories in the p✓pa✓at✓th✓h variable to be recomputed.  This is
  998.                    needed if new commands are added to directories in the p✓pa✓at✓th✓h
  999.                    while you are logged in.  This should only be necessary if
  1000.                    you add commands to one of your own directories, or if a
  1001.                    systems programmer changes the contents of one of the sys-
  1002.                    tem directories.
  1003.  
  1004.            r✓re✓ep✓pe✓ea✓at✓t _✓c_✓o_✓u_✓n_✓t _✓c_✓o_✓m_✓m_✓a_✓n_✓d
  1005.                    The specified _✓c_✓o_✓m_✓m_✓a_✓n_✓d which is subject to the same restric-
  1006.                    tions as the _✓c_✓o_✓m_✓m_✓a_✓n_✓d in the one line i✓if✓f statement above, is
  1007.                    executed _✓c_✓o_✓u_✓n_✓t times.  I/O redirections occur exactly once,
  1008.                    even if _✓c_✓o_✓u_✓n_✓t is 0.
  1009.  
  1010.            s✓se✓et✓t
  1011.            s✓se✓et✓t _✓n_✓a_✓m_✓e
  1012.            s✓se✓et✓t _✓n_✓a_✓m_✓e=word
  1013.            s✓se✓et✓t _✓n_✓a_✓m_✓e_✓[_✓i_✓n_✓d_✓e_✓x_✓]=word
  1014.            s✓se✓et✓t _✓n_✓a_✓m_✓e=(wordlist)
  1015.                    The first form of the command shows the value of all shell
  1016.                    variables.  Variables which have other than a single word
  1017.                    as value print as a parenthesized word list.  The second
  1018.                    form sets n✓na✓am✓me✓e to the null string.  The third form sets
  1019.                    n✓na✓am✓me✓e to the single w✓wo✓or✓rd✓d. The fourth form sets the _✓i_✓n_✓d_✓e_✓x'th
  1020.                    component of name to word; this component must already ex-
  1021.                    ist.  The final form sets _✓n_✓a_✓m_✓e to the list of words in
  1022.                    _✓w_✓o_✓r_✓d_✓l_✓i_✓s_✓t. In all cases the value is command and filename
  1023.                    expanded.
  1024.  
  1025.                    These arguments may be repeated to set multiple values in a
  1026.                    single set command.  Note however, that variable expansion
  1027.                    happens for all arguments before any setting occurs.
  1028.  
  1029.            s✓se✓et✓te✓en✓nv✓v
  1030.            s✓se✓et✓te✓en✓nv✓v _✓n_✓a_✓m_✓e _✓v_✓a_✓l_✓u_✓e
  1031.            s✓se✓et✓te✓en✓nv✓v _✓n_✓a_✓m_✓e
  1032.                    The first form lists all current environment variables.
  1033.                    The last form sets the value of environment variable _✓n_✓a_✓m_✓e
  1034.                    to be _✓v_✓a_✓l_✓u_✓e, a single string.  The second form sets _✓n_✓a_✓m_✓e to
  1035.                    an empty string.  The most commonly used environment vari-
  1036.                    able USER, TERM, and PATH are automatically imported to and
  1037.                    exported from the c✓cs✓sh✓h variables _✓u_✓s_✓e_✓r, [_✓t_✓e_✓r_✓m], and _✓p_✓a_✓t_✓h;
  1038.                    there is no need to use s✓se✓et✓te✓en✓nv✓v for these.
  1039.  
  1040.            s✓sh✓hi✓if✓ft✓t
  1041.            s✓sh✓hi✓if✓ft✓t _✓v_✓a_✓r_✓i_✓a_✓b_✓l_✓e
  1042.                    The members of a✓ar✓rg✓gv✓v are shifted to the left, discarding
  1043.                    a✓ar✓rg✓gv✓v [1]. It is an error for a✓ar✓rg✓gv✓v not to be set or to have
  1044.                    less than one word as value.  The second form performs the
  1045.                    same function on the specified variable.
  1046.  
  1047.            s✓so✓ou✓ur✓rc✓ce✓e _✓n_✓a_✓m_✓e
  1048.            s✓so✓ou✓ur✓rc✓ce✓e -✓-h✓h _✓n_✓a_✓m_✓e
  1049.                    The shell reads commands from n✓na✓am✓me✓e. S✓So✓ou✓ur✓rc✓ce✓e commands may be
  1050.                    nested; if they are nested too deeply the shell may run out
  1051.                    of file descriptors.  An error in a s✓so✓ou✓ur✓rc✓ce✓e at any level
  1052.                    terminates all nested s✓so✓ou✓ur✓rc✓ce✓e commands.  Normally input dur-
  1053.                    ing s✓so✓ou✓ur✓rc✓ce✓e commands is not placed on the history list; the
  1054.                    -h option causes the commands to be placed in the history
  1055.                    list without being executed.
  1056.  
  1057.            s✓st✓to✓op✓p
  1058.            s✓st✓to✓op✓p %✓%_✓j_✓o_✓b _✓._✓._✓.
  1059.                    Stops the current or specified job which is executing in
  1060.                    the background.
  1061.  
  1062.            s✓su✓us✓sp✓pe✓en✓nd✓d
  1063.                    Causes the shell to stop in its tracks, much as if it had
  1064.                    been sent a stop signal with ^✓^Z✓Z. This is most often used to
  1065.                    stop shells started by su(1).
  1066.  
  1067.            s✓sw✓wi✓it✓tc✓ch✓h _✓(_✓s_✓t_✓r_✓i_✓n_✓g_✓)
  1068.            c✓ca✓as✓se✓e _✓s_✓t_✓r_✓1:
  1069.                ...
  1070.                b✓br✓re✓ea✓ak✓ks✓sw✓w
  1071.                ...
  1072.            d✓de✓ef✓fa✓au✓ul✓lt✓t:
  1073.                ...
  1074.                b✓br✓re✓ea✓ak✓ks✓sw✓w
  1075.            e✓en✓nd✓ds✓sw✓w   Each case label is successively matched, against the speci-
  1076.                    fied _✓s_✓t_✓r_✓i_✓n_✓g which is first command and filename expanded.
  1077.                    The file metacharacters `*', `?' and `[...]'  may be used
  1078.                    in the case labels, which are variable expanded.  If none
  1079.                    of the labels match before a `default' label is found, then
  1080.                    the execution begins after the default label.  Each case
  1081.                    label and the default label must appear at the beginning of
  1082.                    a line.  The command b✓br✓re✓ea✓ak✓ks✓sw✓w causes execution to continue
  1083.                    after the e✓en✓nd✓ds✓sw✓w. Otherwise control may fall through case
  1084.                    labels and default labels as in C.  If no label matches and
  1085.                    there is no default, execution continues after the e✓en✓nd✓ds✓sw✓w.
  1086.  
  1087.            t✓ti✓im✓me✓e
  1088.            t✓ti✓im✓me✓e _✓c_✓o_✓m_✓m_✓a_✓n_✓d
  1089.                    With no argument, a summary of time used by this shell and
  1090.                    its children is printed.  If arguments are given the speci-
  1091.                    fied simple command is timed and a time summary as de-
  1092.                    scribed under the t✓ti✓im✓me✓e variable is printed.  If necessary,
  1093.                    an extra shell is created to print the time statistic when
  1094.                    the command completes.
  1095.  
  1096.            u✓um✓ma✓as✓sk✓k
  1097.            u✓um✓ma✓as✓sk✓k _✓v_✓a_✓l_✓u_✓e
  1098.                    The file creation mask is displayed (first form) or set to
  1099.                    the specified value (second form).  The mask is given in
  1100.                    octal.  Common values for the mask are 002 giving all ac-
  1101.                    cess to the group and read and execute access to others or
  1102.                    022 giving all access except no write access for users in
  1103.                    the group or others.
  1104.  
  1105.            u✓un✓na✓al✓li✓ia✓as✓s _✓p_✓a_✓t_✓t_✓e_✓r_✓n
  1106.                    All aliases whose names match the specified pattern are
  1107.                    discarded.  Thus all aliases are removed by `unalias *'.
  1108.                    It is not an error for nothing to be u✓un✓na✓al✓li✓ia✓as✓se✓ed✓d.
  1109.  
  1110.            u✓un✓nh✓ha✓as✓sh✓h  Use of the internal hash table to speed location of execut-
  1111.                    ed programs is disabled.
  1112.  
  1113.            u✓un✓nl✓li✓im✓mi✓it✓t
  1114.            u✓un✓nl✓li✓im✓mi✓it✓t _✓r_✓e_✓s_✓o_✓u_✓r_✓c_✓e
  1115.            u✓un✓nl✓li✓im✓mi✓it✓t -✓-h✓h
  1116.            u✓un✓nl✓li✓im✓mi✓it✓t -✓-h✓h _✓r_✓e_✓s_✓o_✓u_✓r_✓c_✓e
  1117.                    Removes the limitation on _✓r_✓e_✓s_✓o_✓u_✓r_✓c_✓e. If no _✓r_✓e_✓s_✓o_✓u_✓r_✓c_✓e is spec-
  1118.                    ified, then all _✓r_✓e_✓s_✓o_✓u_✓r_✓c_✓e limitations are removed.  If -✓-h✓h is
  1119.                    given, the corresponding hard limits are removed.  Only the
  1120.                    super-user may do this.
  1121.  
  1122.  
  1123.            u✓un✓ns✓se✓et✓t _✓p_✓a_✓t_✓t_✓e_✓r_✓n
  1124.                    All variables whose names match the specified pattern are
  1125.                    removed.  Thus all variables are removed by `unset *'; this
  1126.                    has noticeably distasteful side-effects.  It is not an er-
  1127.                    ror for nothing to be u✓un✓ns✓se✓et✓t.
  1128.  
  1129.            u✓un✓ns✓se✓et✓te✓en✓nv✓v _✓p_✓a_✓t_✓t_✓e_✓r_✓n
  1130.                    Removes all variables whose name match the specified pat-
  1131.                    tern from the environment.  See also the s✓se✓et✓te✓en✓nv✓v command
  1132.                    above and printenv(1).
  1133.  
  1134.            w✓wa✓ai✓it✓t    All background jobs are waited for.  It the shell is inter-
  1135.                    active, then an interrupt can disrupt the wait, at which
  1136.                    time the shell prints names and job numbers of all jobs
  1137.                    known to be outstanding.
  1138.  
  1139.            w✓wh✓hi✓il✓le✓e _✓(_✓e_✓x_✓p_✓r_✓)
  1140.            ...
  1141.            e✓en✓nd✓d     While the specified expression evaluates non-zero, the com-
  1142.                    mands between the w✓wh✓hi✓il✓le✓e and the matching end are evaluated.
  1143.                    B✓Br✓re✓ea✓ak✓k and c✓co✓on✓nt✓ti✓in✓nu✓ue✓e may be used to terminate or continue the
  1144.                    loop prematurely.  (The w✓wh✓hi✓il✓le✓e and e✓en✓nd✓d must appear alone on
  1145.                    their input lines.)  Prompting occurs here the first time
  1146.                    through the loop as for the f✓fo✓or✓re✓ea✓ac✓ch✓h statement if the input
  1147.                    is a terminal.
  1148.  
  1149.            %✓% _✓j_✓o_✓b   Brings the specified job into the foreground.
  1150.  
  1151.            %✓% _✓j_✓o_✓b &✓&
  1152.                    Continues the specified job in the background.
  1153.  
  1154.            @✓@
  1155.            @✓@_✓n_✓a_✓m_✓e= expr
  1156.            @✓@_✓n_✓a_✓m_✓e_✓[_✓i_✓n_✓d_✓e_✓x_✓]= expr
  1157.                    The first form prints the values of all the shell vari-
  1158.                    ables.  The second form sets the specified _✓n_✓a_✓m_✓e to the val-
  1159.                    ue of _✓e_✓x_✓p_✓r. If the expression contains `<', `>', `&' or `'
  1160.                    then at least this part of the expression must be placed
  1161.                    within `(' `)'.  The third form assigns the value of _✓e_✓x_✓p_✓r
  1162.                    to the _✓i_✓n_✓d_✓e_✓x'th argument of _✓n_✓a_✓m_✓e. Both _✓n_✓a_✓m_✓e and its
  1163.                    _✓i_✓n_✓d_✓e_✓x'th component must already exist.
  1164.  
  1165.      The operators `*=', `+=', etc are available as in C.  The space separat-
  1166.      ing the name from the assignment operator is optional.  Spaces are, how-
  1167.      ever, mandatory in separating components of _✓e_✓x_✓p_✓r which would otherwise be
  1168.      single words.
  1169.  
  1170.      Special postfix `++' and `--' operators increment and decrement _✓n_✓a_✓m_✓e re-
  1171.      spectively, i.e. `@  i++'.
  1172.  
  1173.    P✓Pr✓re✓e-✓-d✓de✓ef✓fi✓in✓ne✓ed✓d a✓an✓nd✓d e✓en✓nv✓vi✓ir✓ro✓on✓nm✓me✓en✓nt✓t v✓va✓ar✓ri✓ia✓ab✓bl✓le✓es✓s
  1174.      The following variables have special meaning to the shell.  Of these,
  1175.      _✓a_✓r_✓g_✓v, _✓c_✓w_✓d_✓, _✓h_✓o_✓m_✓e, _✓p_✓a_✓t_✓h_✓, _✓p_✓r_✓o_✓m_✓p_✓t, _✓s_✓h_✓e_✓l_✓l and _✓s_✓t_✓a_✓t_✓u_✓s are always set by the
  1176.      shell.  Except for _✓c_✓w_✓d and _✓s_✓t_✓a_✓t_✓u_✓s this setting occurs only at initializa-
  1177.      tion; these variables will not then be modified unless this is done ex-
  1178.      plicitly by the user.
  1179.  
  1180.      This shell copies the environment variable USER into the variable _✓u_✓s_✓e_✓r,
  1181.      TERM into _✓t_✓e_✓r_✓m, and HOME into _✓h_✓o_✓m_✓e, and copies these back into the envi-
  1182.      ronment whenever the normal shell variables are reset.  The environment
  1183.      variable PATH is likewise handled; it is not necessary to worry about its
  1184.      setting other than in the file _✓._✓c_✓s_✓h_✓r_✓c as inferior c✓cs✓sh✓h processes will im-
  1185.      port the definition of _✓p_✓a_✓t_✓h from the environment, and re-export it if you
  1186.  
  1187.  
  1188.      then change it.
  1189.  
  1190.      a✓ar✓rg✓gv✓v       Set to the arguments to the shell, it is from this variable
  1191.                 that positional parameters are substituted, i.e. `$1' is re-
  1192.                 placed by `$argv[1]', etc.
  1193.  
  1194.      c✓cd✓dp✓pa✓at✓th✓h     Gives a list of alternate directories searched to find subdi-
  1195.                 rectories in _✓c_✓h_✓d_✓i_✓r commands.
  1196.  
  1197.      c✓cw✓wd✓d        The full pathname of the current directory.
  1198.  
  1199.      e✓ec✓ch✓ho✓o       Set when the -✓-x✓x command line option is given.  Causes each
  1200.                 command and its arguments to be echoed just before it is exe-
  1201.                 cuted.  For non-builtin commands all expansions occur before
  1202.                 echoing.  Builtin commands are echoed before command and file-
  1203.                 name substitution, since these substitutions are then done se-
  1204.                 lectively.
  1205.  
  1206.      f✓fi✓il✓le✓ec✓c      Enable file name completion.
  1207.  
  1208.      h✓hi✓is✓st✓tc✓ch✓ha✓ar✓rs✓s  Can be given a string value to change the characters used in
  1209.                 history substitution.  The first character of its value is
  1210.                 used as the history substitution character, replacing the de-
  1211.                 fault character `!'.  The second character of its value re-
  1212.                 places the character `|✓^' in quick substitutions.
  1213.  
  1214.      h✓hi✓is✓st✓to✓or✓ry✓y    Can be given a numeric value to control the size of the histo-
  1215.                 ry list.  Any command which has been referenced in this many
  1216.                 events will not be discarded.  Too large values of _✓h_✓i_✓s_✓t_✓o_✓r_✓y may
  1217.                 run the shell out of memory.  The last executed command is al-
  1218.                 ways saved on the history list.
  1219.  
  1220.      h✓ho✓om✓me✓e       The home directory of the invoker, initialized from the envi-
  1221.                 ronment.  The filename expansion of `_✓~' refers to this vari-
  1222.                 able.
  1223.  
  1224.      i✓ig✓gn✓no✓or✓re✓ee✓eo✓of✓f  If set the shell ignores end-of-file from input devices which
  1225.                 are terminals.  This prevents shells from accidentally being
  1226.                 killed by control-D's.
  1227.  
  1228.      m✓ma✓ai✓il✓l       The files where the shell checks for mail.  This is done after
  1229.                 each command completion which will result in a prompt, if a
  1230.                 specified interval has elapsed.  The shell says `You have new
  1231.                 mail.'  if the file exists with an access time not greater
  1232.                 than its modify time.
  1233.  
  1234.                 If the first word of the value of _✓m_✓a_✓i_✓l is numeric it specifies
  1235.                 a different mail checking interval, in seconds, than the de-
  1236.                 fault, which is 10 minutes.
  1237.  
  1238.                 If multiple mail files are specified, then the shell says `New
  1239.                 mail in _✓n_✓a_✓m_✓e' when there is mail in the file _✓n_✓a_✓m_✓e.
  1240.  
  1241.      n✓no✓oc✓cl✓lo✓ob✓bb✓be✓er✓r  As described in the section on _✓I_✓n_✓p_✓u_✓t_✓/_✓o_✓u_✓t_✓p_✓u_✓t, restrictions are
  1242.                 placed on output redirection to insure that files are not ac-
  1243.                 cidentally destroyed, and that `>>' redirections refer to ex-
  1244.                 isting files.
  1245.  
  1246.      n✓no✓og✓gl✓lo✓ob✓b     If set, filename expansion is inhibited.  This is most useful
  1247.                 in shell scripts which are not dealing with filenames, or af-
  1248.                 ter a list of filenames has been obtained and further expan-
  1249.                 sions are not desirable.
  1250.  
  1251.      n✓no✓on✓no✓om✓ma✓at✓tc✓ch✓h  If set, it is not an error for a filename expansion to not
  1252.                 match any existing files; rather the primitive pattern is re-
  1253.                 turned.  It is still an error for the primitive pattern to be
  1254.  
  1255.                 malformed, i.e.  `echo [' still gives an error.
  1256.  
  1257.      n✓no✓ot✓ti✓if✓fy✓y     If set, the shell notifies asynchronously of job completions.
  1258.                 The default is to rather present job completions just before
  1259.                 printing a prompt.
  1260.  
  1261.      p✓pa✓at✓th✓h       Each word of the path variable specifies a directory in which
  1262.                 commands are to be sought for execution.  A null word speci-
  1263.                 fies the current directory.  If there is no _✓p_✓a_✓t_✓h variable then
  1264.                 only full path names will execute.  The usual search path is
  1265.                 `.', `/bin' and `/usr/bin', but this may vary from system to
  1266.                 system.  For the super-user the default search path is `/etc',
  1267.                 `/bin' and `/usr/bin'.  A shell which is given neither the -✓-c✓c
  1268.                 nor the -✓-t✓t option will normally hash the contents of the di-
  1269.                 rectories in the _✓p_✓a_✓t_✓h variable after reading _✓._✓c_✓s_✓h_✓r_✓c, and each
  1270.                 time the _✓p_✓a_✓t_✓h variable is reset.  If new commands are added to
  1271.                 these directories while the shell is active, it may be neces-
  1272.                 sary to do a r✓re✓eh✓ha✓as✓sh✓h or the commands may not be found.
  1273.  
  1274.      p✓pr✓ro✓om✓mp✓pt✓t     The string which is printed before each command is read from
  1275.                 an interactive terminal input.  If a `!' appears in the string
  1276.                 it will be replaced by the current event number unless a pre-
  1277.                 ceding `\' is given.  Default is `% ', or `# ' for the super-
  1278.                 user.
  1279.  
  1280.      s✓sa✓av✓ve✓eh✓hi✓is✓st✓t   Is given a numeric value to control the number of entries of
  1281.                 the history list that are saved in ~/.history when the user
  1282.                 logs out.  Any command which has been referenced in this many
  1283.                 events will be saved.  During start up the shell sources
  1284.                 ~/.history into the history list enabling history to be saved
  1285.                 across logins.  Too large values of _✓s_✓a_✓v_✓e_✓h_✓i_✓s_✓t will slow down
  1286.                 the shell during start up.
  1287.  
  1288.      s✓sh✓he✓el✓ll✓l      The file in which the shell resides.  This is used in forking
  1289.                 shells to interpret files which have execute bits set, but
  1290.                 which are not executable by the system.  (See the description
  1291.                 of _✓N_✓o_✓n_✓-_✓b_✓u_✓i_✓l_✓t_✓i_✓n _✓C_✓o_✓m_✓m_✓a_✓n_✓d _✓E_✓x_✓e_✓c_✓u_✓t_✓i_✓o_✓n below.)  Initialized to the
  1292.                 (system-dependent) home of the shell.
  1293.  
  1294.      s✓st✓ta✓at✓tu✓us✓s     The status returned by the last command.  If it terminated ab-
  1295.                 normally, then 0200 is added to the status.  Builtin commands
  1296.                 which fail return exit status `1', all other builtin commands
  1297.                 set status `0'.
  1298.  
  1299.      t✓ti✓im✓me✓e       Controls automatic timing of commands.  If set, then any com-
  1300.                 mand which takes more than this many cpu seconds will cause a
  1301.                 line giving user, system, and real times and a utilization
  1302.                 percentage which is the ratio of user plus system times to re-
  1303.                 al time to be printed when it terminates.
  1304.  
  1305.      v✓ve✓er✓rb✓bo✓os✓se✓e    Set by the -✓-v✓v command line option, causes the words of each
  1306.                 command to be printed after history substitution.
  1307.  
  1308.    N✓No✓on✓n-✓-b✓bu✓ui✓il✓lt✓ti✓in✓n c✓co✓om✓mm✓ma✓an✓nd✓d e✓ex✓xe✓ec✓cu✓ut✓ti✓io✓on✓n
  1309.      When a command to be executed is found to not be a builtin command the
  1310.      shell attempts to execute the command via execve(2).  Each word in the
  1311.      variable _✓p_✓a_✓t_✓h names a directory from which the shell will attempt to exe-
  1312.      cute the command.  If it is given neither a -✓-c✓c nor a -✓-t✓t option, the shell
  1313.      will hash the names in these directories into an internal table so that
  1314.      it will only try an e✓ex✓xe✓ec✓c in a directory if there is a possibility that
  1315.      the command resides there.  This greatly speeds command location when a
  1316.      large number of directories are present in the search path.  If this
  1317.      mechanism has been turned off (via u✓un✓nh✓ha✓as✓sh✓h), or if the shell was given a
  1318.      -✓-c✓c or -✓-t✓t argument, and in any case for each directory component of _✓p_✓a_✓t_✓h
  1319.      which does not begin with a `/', the shell concatenates with the given
  1320.      command name to form a path name of a file which it then attempts to exe-
  1321.      cute.
  1322.  
  1323.      Parenthesized commands are always executed in a subshell.  Thus
  1324.  
  1325.            (cd; pwd); pwd
  1326.  
  1327.      prints the _✓h_✓o_✓m_✓e directory; leaving you where you were (printing this af-
  1328.      ter the home directory), while
  1329.  
  1330.            cd; pwd
  1331.  
  1332.      leaves you in the _✓h_✓o_✓m_✓e directory.  Parenthesized commands are most often
  1333.      used to prevent c✓ch✓hd✓di✓ir✓r from affecting the current shell.
  1334.  
  1335.      If the file has execute permissions but is not an executable binary to
  1336.      the system, then it is assumed to be a file containing shell commands and
  1337.      a new shell is spawned to read it.
  1338.  
  1339.      If there is an a✓al✓li✓ia✓as✓s for s✓sh✓he✓el✓ll✓l then the words of the alias will be
  1340.      prepended to the argument list to form the shell command.  The first word
  1341.      of the a✓al✓li✓ia✓as✓s should be the full path name of the shell (e.g. `$shell').
  1342.      Note that this is a special, late occurring, case of a✓al✓li✓ia✓as✓s substitution,
  1343.      and only allows words to be prepended to the argument list without modi-
  1344.      fication.
  1345.  
  1346.    S✓Si✓ig✓gn✓na✓al✓l h✓ha✓an✓nd✓dl✓li✓in✓ng✓g
  1347.      The shell normally ignores _✓q_✓u_✓i_✓t signals.  Jobs running detached (either
  1348.      by &✓& or the b✓bg✓g or %✓%.✓..✓..✓. &✓& commands) are immune to signals generated from
  1349.      the keyboard, including hangups.  Other signals have the values which the
  1350.      shell inherited from its parent.  The shell's handling of interrupts and
  1351.      terminate signals in shell scripts can be controlled by o✓on✓ni✓in✓nt✓tr✓r. Login
  1352.      shells catch the _✓t_✓e_✓r_✓m_✓i_✓n_✓a_✓t_✓e signal; otherwise this signal is passed on to
  1353.      children from the state in the shell's parent.  In no case are interrupts
  1354.      allowed when a login shell is reading the file _✓._✓l_✓o_✓g_✓o_✓u_✓t.
  1355.  
  1356. A✓AU✓UT✓TH✓HO✓OR✓R
  1357.      William Joy.  Job control and directory stack features first implemented
  1358.      by J.E. Kulp of IIASA, Laxenburg, Austria, with different syntax than
  1359.      that used now.  File name completion code written by Ken Greer, HP Labs.
  1360.      Eight-bit implementation Christos S. Zoulas, Cornell University.
  1361.  
  1362. F✓FI✓IL✓LE✓ES✓S
  1363.      ~/.cshrc     Read at beginning of execution by each shell.
  1364.      ~/.login     Read by login shell, after `.cshrc' at login.
  1365.      ~/.logout    Read by login shell, at logout.
  1366.      /bin/sh      Standard shell, for shell scripts not starting with a `#'.
  1367.      /tmp/sh*     Temporary file for `<<'.
  1368.      /etc/passwd  Source of home directories for `~name'.
  1369.  
  1370. L✓LI✓IM✓MI✓IT✓TA✓AT✓TI✓IO✓ON✓NS✓S
  1371.      Word lengths - Words can be no longer than 1024 characters.  The system
  1372.      limits argument lists to 10240 characters.  The number of arguments to a
  1373.      command which involves filename expansion is limited to 1/6'th the number
  1374.      of characters allowed in an argument list.  Command substitutions may
  1375.      substitute no more characters than are allowed in an argument list.  To
  1376.      detect looping, the shell restricts the number of a✓al✓li✓ia✓as✓s substitutions on
  1377.      a single line to 20.
  1378.  
  1379. S✓SE✓EE✓E A✓AL✓LS✓SO✓O
  1380.      sh(1),  access(2),  execve(2),  fork(2),  killpg(2),  pipe(2),
  1381.      sigvec(2),  umask(2),  setrlimit(2),  wait(2),  tty(4),  a.out(5),
  1382.      environ(7),
  1383.      introduction to the C shell
  1384.  
  1385. H✓HI✓IS✓ST✓TO✓OR✓RY✓Y
  1386.      C✓Cs✓sh✓h appeared in 3BSD. It was a first implementation of a command language
  1387.      interpreter incorporating a history mechanism (see _✓H_✓i_✓s_✓t_✓o_✓r_✓y
  1388.      _✓S_✓u_✓b_✓s_✓t_✓i_✓t_✓u_✓t_✓i_✓o_✓n_✓s), job control facilities (see _✓J_✓o_✓b_✓s), interactive file name
  1389.      and user name completion (see _✓F_✓i_✓l_✓e _✓N_✓a_✓m_✓e _✓C_✓o_✓m_✓p_✓l_✓e_✓t_✓i_✓o_✓n), and a C-like syntax.
  1390.      There are now many shells which also have these mechanisms, plus a few
  1391.      more (and maybe some bugs too), which are available thru the usenet, or
  1392.      with BSD UNIX as contributed software like the ksh(korn shell).
  1393.  
  1394. B✓BU✓UG✓GS✓S
  1395.      When a command is restarted from a stop, the shell prints the directory
  1396.      it started in if this is different from the current directory; this can
  1397.      be misleading (i.e. wrong) as the job may have changed directories inter-
  1398.      nally.
  1399.  
  1400.      Shell builtin functions are not stoppable/restartable.  Command sequences
  1401.      of the form `a ; b ; c' are also not handled gracefully when stopping is
  1402.      attempted.  If you suspend `b', the shell will then immediately execute
  1403.      `c'.  This is especially noticeable if this expansion results from an
  1404.      _✓a_✓l_✓i_✓a_✓s. It suffices to place the sequence of commands in ()'s to force it
  1405.      to a subshell, i.e. `( a ; b ; c )'.
  1406.  
  1407.      Control over tty output after processes are started is primitive; perhaps
  1408.      this will inspire someone to work on a good virtual terminal interface.
  1409.      In a virtual terminal interface much more interesting things could be
  1410.      done with output control.
  1411.  
  1412.      Alias substitution is most often used to clumsily simulate shell proce-
  1413.      dures; shell procedures should be provided rather than aliases.
  1414.  
  1415.      Commands within loops, prompted for by `?', are not placed in the h✓hi✓is✓st✓to✓or✓ry✓y
  1416.      list.  Control structure should be parsed rather than being recognized as
  1417.      built-in commands.  This would allow control commands to be placed any-
  1418.      where, to be combined with `|', and to be used with `&' and `;' metasyn-
  1419.      tax.
  1420.  
  1421.      It should be possible to use the `:' modifiers on the output of command
  1422.      substitutions.  All and more than one `:' modifier should be allowed on
  1423.      `$' substitutions.
  1424.  
  1425.      The way the f✓fi✓il✓le✓ec✓c facility is implemented is ugly and expensive.
  1426.  
  1427. 4th Berkeley Distribution        June 7, 1991                               22
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.